~~BOZZA~~
This document describe how to use the H2C40 card for control of stepper motors with Qview software (device settings) and in terms of hardware (card features).
The following picture shows the block diagram of a conventional positioning system, or analog output:
QEM instrument implements the trajectory and loop position generator.
The generator of the trajectory (EANPOS or CAMMING or JOINT device of QMOVE and microQMOVE family) generate the position at each execution (sampling). This value is the position it should take the axis (èalso called “virtual profile”) at each sampling instant. Now, in the drive for stepper motors they represent the impulses that must be provided to move the motor of the steps that match the position. Because each pulse the motor performs a step (or half step or microstep depending on the drive or of its programming) the pulse rate determines the rate of motor displacement.
The movement of stepper motors can be performed using all systems that are equipped with positioning device having as a output analog voltage (EANPOS, CAMMING3, JOINT) and there is a H2C40 card that implements the pitch/yaw output generation.
The device will be used as positioning for cases with the analog output done d the following notes:
- In the device declaration, on the configuration file, you must set the bidirectional counter input to X.X so that the posit parameter is the value of the virtual position.
- In the device declaration, on the configuration file, you must set the hardware address of the DAC componentof the analog output with the slot number and the keyword PULSE01 or PULSE02 (instead of an01, an02).
- Positioning devices that drive stepper motors work in open loop so you don't need to run the LOOPON command (even if you execute, has no effect on the output of control).
- The pulse parameter must be set to the number of steps per revolution of the motor If you are using a full step resolution. In the case of higher resolutions (created by microstepping drives) the pulse parameter must be set to the number of step/Rev of the motor multiplied for the resolution. For example, having a motor from 200 steps/Rev and a drive set at a resolution of 1/10 by step we will have to set the pulse parameter with value 2000.
- The measure parameter must be set to the value of units of measurement corresponding to one revolution of the motor.
- The maxvel parameter, unlike positioners with analog output where the setting value corresponds to the speed reached by the axis, expressed in units of measurement, when the analogue output is 10V, in the positioner with stepper motors this parameter defines the maximum speed to which you want to move the axis. This speed must be chosen according to the characteristics of the motor and the load, because the torque delivered by a stepper motor is highly dependent on the speed.
Il valore di maxvel è anche restrittivo per la scelta della risoluzione di pilotaggio dell'azionamento (micropassi) poichè esso determina la massima frequenza di uscita del segnale impulsi. Ad esempio, avendo un'applicazione con le seguenti caratteristiche:
motore passo passo 200 passi/giro
azionamento con risoluzione 1/20 di passo
vite con passo 2mm
velocità massima motore 2mt/min
La velocità massima corrisponde a 1000 rpm quindi la frequenza di uscità dovrà essere (1000rpm*4000 imp/giro)/60 = 66666 Hz
Si deve quindi verificare che la scheda di pilotaggio sia in grado di generare tale frequenza. In caso contrario si deve abbassare la risoluzione oppure diminuire la velocità massima; ad esempio la scheda H2C40 può raggiungere solamente 50KHz; avremo una velocità massima possibile di 750 rpm oppure abbassando la risoluzione a 1/10 di passo potremo arrivare fino a 1500rpm.
Per agevolare il calcolo del parametro maxvel a partire dalla massima frequenza che si desidera ottenere nell'uscita STEP, è possibile utilizzare la subroutine “CalMaxVel” dell'applicativo di esempio “DEMO_L2CZ2”. N.B.Questa funzione puó essere utilizzata solo con il parametro unitvel = 1.
Per le particolarità firmware del generatore di impulsi e della discretizzazione dell'uscita, la velocità di movimento dell'asse è condizionata dal tempo di campionamento. Per quello che si è potuto vedere su un sistema con vite-madrevite (non è detto che sia esattamente la stessa cosa su un sistema con trasmissione di movimento con cinghia elastica) l'impostazione di velocità corrispondenti a frequenze di uscita del segnale impulsi non multiple della frequenza di campionamento può generare vibrazioni sull'asse. Ci troveremmo in questa condizione, ad esempio, se avessimo un device con tempo di campionamento di 2ms e volessimo posizionare ad una velocità alla quale corrisponde una frequenza di 10200Hz. Il sistema è in grado di generare solamente frequenze multiple della frequenza di campionamento che è 500Hz, perciò dovremmo impostare una velocità alla quale corrisponde una frequenza di 10000Hz o di 10500Hz. Che cosa succede quando posizioniamo proprio a 10200Hz? Avremo che, per 4 campionamenti la velocità sarà 10000Hz e un per un campionamento invece sarà 10500Hz, la velocità media risulterà 10200Hz ma è come se avessimo un “rumore” sovrapposto alla frequenza di 10000Hz che potrebbe far “vibrare” l'asse. Ove possibile, quindi, è consigliabile impostare valori di velocità che rispettino la regola sopracitata.
Per agevolare il calcolo delle velocitá che non hanno l'effetto del rumore sovrapposto, è possibile utilizzare la subroutine “CalVel” dell'applicativo di esempio “DEMO_L2CZ2”. Questa subroutine calcola un valore di velocitá approssimata per difetto rispetto ad un valore desiderato.
N.B la subroutine funzione solo con unitvel = 1 (Um/s)
N.B nel caso di errore la funzione calco outvel = -1. Sono possibili due errori: 1)unitvel = 0 2) è stato utilizzato un tempo di campionamento che non permette di generare una frequenza di valore finito per es: 3, 6, 7, 9msec, ecc
La scheda L2CZ2 (release hardware 1) consente di pilotare nr. 2 azionamenti per motore passo passo. La frequenza massima dell'uscita STEP è pari a 50KHz. Le uscite sono di tipo NPN con corrente massima di 200mA.
I collegamenti della morsettiera sono:
| Nome | Descrizione |
| COM | Comune delle uscite STEP1, DIR1, STEP2, DIR2. Da collegare allo zero volt degli ingressi azionamento. |
| STEP1 | Uscite STEP-DIREZIONE per l'azionamento 1 (X.PULSE01) |
| DIR1 | |
| STEP2 | Uscite STEP-DIREZIONE per l'azionamento 2 (X.PULSE02) |
| DIR2 |
Di seguito un esempio che dichiara un device EANPOS e muove la posizione tra quota zero e 100.
;--------------------------------------------- ; Project : TEST_H2C40 ; Module Name : CONFIG ; Author : ; Date : 26/04/2007 ; Time : 16.16.56 ; Description : ;--------------------------------------------- ;--------------------------------------------- ; Constants Definition ; ; ConstName Value ;--------------------------------------------- CONST TC_EANPOS 0005 ;--------------------------------------------- ; GLOBAL Variables Definition ; ; VarName Type (F, B, W, L, S) ;--------------------------------------------- GLOBAL myvel L ; - Used in CalVel & CalMaxVel invel L outvel L pulse L meas L tsample W unitvel B decpt B outfrq L frqc S frqp L maxfrq L ;--------------------------------------------- ; TIMER Variables Definition ; ; TimerName ;--------------------------------------------- TIMER timer01 ;--------------------------------------------- ; Bus Configuration ; ; SlotNumber CardName Version ; If not present write '.' in CardName and Version ;--------------------------------------------- BUS 1 992BF 20 2 . . 3 L2CZ2 . ;--------------------------------------------- ; INTDEVICE Declaration ;--------------------------------------------- INTDEVICE ep01 EANPOS TC_EANPOS X.X X.X X 3.PULSE01
;---------------------------------------------
; Project : TEST_H2C40
; Module Name : MODULE1
; Author :
; Date : 26/04/2007
; Time : 16.16.59
; Description :
;---------------------------------------------
ep01:pulse = 4000
ep01:measure = 100
ep01:taccdec = 100
ep01:minpos = -999999
ep01:maxpos = 999999
ep01:setpos = 200
ep01:unitvel = 1
;- Calculate maxvel for 50KHz step output
maxfrq = 50000
pulse = ep01:pulse
meas = ep01:measure
tsample = TC_EANPOS
unitvel = ep01:unitvel
decpt = ep01:decpt
CALL CalMaxVel
IF (NOT(outvel EQ -1)) ; check if an error occur
ep01:maxvel = outvel
ENDIF
INIT ep01
WAIT ep01:st_init
myvel = ep01:maxvel/10
MAIN:
; Calculate setvel based on myvel value
invel = myvel
pulse = ep01:pulse
meas = ep01:measure
tsample = TC_EANPOS
unitvel = ep01:unitvel
decpt = ep01:decpt
CALL CalVel
IF (NOT(outvel EQ -1)) ; check if an error occur
ep01:setvel = outvel
ENDIF
timer01 = 1000
WAIT timer01
ep01:setpos = 100
START ep01
WAIT ep01:st_still
timer01 = 1000
WAIT timer01
ep01:setpos = 0
START ep01
WAIT ep01:st_still
WAIT 1
JUMP MAIN
;------------------
; Calculate velocity for stepper motion
;
; Input:
; invel L - desired velocity
; pulse L - pulse parameter
; meas L - measure parameter
; tsample W - device time sample
; unitvel B - unitvel parameter
; decpt B - decpt parameter
;
; Output:
; outfrq L - step output for desired velocity
; outvel L - velocity calculated
;
; Local variables:
; frqc S
; frqp L
;------------------
SUB CalVel
IF ((NOT unitvel) OR (1000%tsample))
outfrq = -1
outvel = -1
ELSE
outfrq = (invel * pulse) / (meas * POW(10,decpt))
frqc = 1000.0/tsample
IF outfrq LE frqc
outvel = invel
ELSE
frqp = outfrq / frqc
frqc = frqp * frqc
outvel = (frqc * meas * POW(10,decpt)) / pulse
ENDIF
ENDIF
ENDSUB
;------------------
; Calculate max velocity for stepper motion card
;
; Input:
; maxfrq L - max step output frequency
; pulse L - pulse parameter
; meas L - measure parameter
; tsample W - device time sample
; unitvel B - unitvel parameter
; decpt B - decpt parameter
;
; Output:
; outvel L - velocity calculated
;
; Local variables:
; frqc S
; frqp L
;------------------
SUB CalMaxVel
IF (NOT unitvel)
outvel = -1
ELSE
outvel = (maxfrq * meas * POW(10,decpt)) / pulse
ENDIF
ENDSUB
END